ostree.git
9 years agorepo: Fix leak with ostree_repo_commit_traverse_iter_init_commit()
Colin Walters [Fri, 8 Jul 2016 15:26:45 +0000 (11:26 -0400)]
repo: Fix leak with ostree_repo_commit_traverse_iter_init_commit()

I noticed this using `OT_TEST_VALGRIND=1` on `test-basic.sh`.

Closes: #385
Approved by: jlebon

9 years agolibglnx: bump to latest
Jonathan Lebon [Fri, 22 Jul 2016 13:34:32 +0000 (09:34 -0400)]
libglnx: bump to latest

OSTree can sometimes print very long lines which lead to many empty
spaces getting printed if the output overflowed the line due to a bug in
libglnx.

Reported-by: Gatis Paeglis <gatis.paeglis@qt.io>
Closes: #406
Approved by: cgwalters

9 years agodocs/formats: Elaborate a bit on delta from NULL usage
Colin Walters [Tue, 19 Jul 2016 14:24:18 +0000 (10:24 -0400)]
docs/formats: Elaborate a bit on delta from NULL usage

See discussion on ostree-list.

Closes: #402
Approved by: gatispaeglis

9 years agobuild: Make symlink depend on source
Colin Walters [Fri, 15 Jul 2016 15:17:43 +0000 (11:17 -0400)]
build: Make symlink depend on source

Closes: https://github.com/ostreedev/ostree/issues/389
Closes: #400
Approved by: smcv

9 years agocore: Add allocating b64 checksum functions
Dan Nicholson [Thu, 14 Jul 2016 16:09:12 +0000 (09:09 -0700)]
core: Add allocating b64 checksum functions

The checksum_b64_inplace variants can't be used in bindings. Provide
versions that allocate and return the output rather than working on a
passed in buffer. These can then be used in GI bindings to get the
ostree modified base64 encodings.

Closes: #398
Approved by: cgwalters

9 years agolib: Fix version script node ordering
Dan Nicholson [Thu, 14 Jul 2016 19:45:39 +0000 (12:45 -0700)]
lib: Fix version script node ordering

The order of the VERSION nodes is such that the new node name goes first
and the one it depends on goes after the commands. See
https://sourceware.org/binutils/docs/ld/VERSION.html.

Closes: #398
Approved by: cgwalters

9 years agoREADME: Fix broken link
Matthew Leeds [Thu, 14 Jul 2016 20:10:55 +0000 (16:10 -0400)]
README: Fix broken link
Closes: #397
Approved by: cgwalters

9 years agoMakefile-tests.am: make check uses the built binaries
Giuseppe Scrivano [Thu, 14 Jul 2016 11:42:32 +0000 (13:42 +0200)]
Makefile-tests.am: make check uses the built binaries

The tests suite was failing locally as it was using the installed
version of rofiles-fuse, instead of the built one.  Create the needed
symlinks in tests/ as we are already doing for the "ostree" binary.

ostree-prepare-root and ostree-remount added for completeness.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Closes: #395
Approved by: cgwalters

9 years agobuiltins/commit: Switch to using ostree_repo_write_dfd_to_mtree()
Colin Walters [Wed, 13 Jul 2016 15:46:16 +0000 (11:46 -0400)]
builtins/commit: Switch to using ostree_repo_write_dfd_to_mtree()

Where we're referencing local files.  It's what
ostree_repo_write_directory_to_mtree() is doing internally anyways,
and I consider the `GFile*` based APIs to be generally deprecated for
the most part.

Closes: #394
Approved by: giuseppe

9 years agorepo: Ensure we set mode for bare-user files before xattrs
Colin Walters [Tue, 12 Jul 2016 13:43:32 +0000 (09:43 -0400)]
repo: Ensure we set mode for bare-user files before xattrs

When trying to switch ostree to `O_TMPFILE`, I hit the fact that
by default it uses mode `000`.  It still works to write to the
open fd of course, but it *doesn't* work to set xattrs because
that code path for some reason in the kernel checks the mode bits.

This only broke for bare-user repos where we tried to set the xattr
before calling `fchmod()`, so just invert those two operations.

Closes: #391
Approved by: jlebon

9 years agoRevert "tests/libtest.sh: Print non-matching file on failure"
Colin Walters [Mon, 11 Jul 2016 19:18:34 +0000 (15:18 -0400)]
Revert "tests/libtest.sh: Print non-matching file on failure"

This reverts commit 71301d18244a3a26a6ba6fd3934633ef94811a15.

I was confused by the fact that the non-matching content was
empty and forgot we already did print it.

Reported-by: smcv
Closes: #390
Approved by: jlebon

9 years agotests: Fix karg tests on ostree-booted system
Colin Walters [Fri, 8 Jul 2016 14:54:11 +0000 (10:54 -0400)]
tests: Fix karg tests on ostree-booted system

https://github.com/ostreedev/ostree/pull/372 caused these tests to
start failing when the host system is managed using ostree - since the
tests *do* replace the `ostree=` kernel argument.

Closes: #384
Approved by: cgwalters

9 years agorepo: Fix annotation for ostree_repo_add_gpg_signature_summary
Dan Nicholson [Fri, 8 Jul 2016 20:51:36 +0000 (13:51 -0700)]
repo: Fix annotation for ostree_repo_add_gpg_signature_summary

GI needs to know this is a NULL terminated array of gchar or you'll
segfault using it from a binding.

Closes: #387
Approved by: cgwalters

9 years agoRelease 2016.7
Colin Walters [Fri, 8 Jul 2016 19:29:11 +0000 (15:29 -0400)]
Release 2016.7

Closes: #386
Approved by: jlebon

9 years agofetcher: Remove unused GTask structure member
Colin Walters [Fri, 8 Jul 2016 17:17:33 +0000 (13:17 -0400)]
fetcher: Remove unused GTask structure member

Spotted by mbarnes.

Closes: #383
Approved by: mbarnes

9 years agofetcher: Clear all data for session in session thread
Colin Walters [Fri, 8 Jul 2016 14:15:47 +0000 (10:15 -0400)]
fetcher: Clear all data for session in session thread

Conceptually the session thread owns the session, so let's clear out
everything predictably there, rather than sometimes having it happen
on the main thread.

Also, this moves up clearing the pending/outstanding queues *before*
we unreference the session, since conceptually they need to reference
it as well.

Based on a patch from: Matthew Barnes <mbarnes@redhat.com>

Closes: #383
Approved by: mbarnes

9 years agofetcher: Hold a ref to main context for lifetime of thread
Colin Walters [Fri, 8 Jul 2016 14:01:47 +0000 (10:01 -0400)]
fetcher: Hold a ref to main context for lifetime of thread

I don't think this fixes the bug I was seeing, but it makes me more
comfortable to know we have a strong ref to the main context across
the thread lifetime, and we only unset the default right before
we go away.

If something in `thread_closure_unref()` used
`g_main_context_get_thread_default()` for example it'd be wrong
before.

Closes: #383
Approved by: mbarnes

9 years agotests: Add some test coverage of repeated pulls w/HTTP 500s
Colin Walters [Thu, 7 Jul 2016 21:39:07 +0000 (17:39 -0400)]
tests: Add some test coverage of repeated pulls w/HTTP 500s

Systems like pulp may want to keep retrying in a loop if the server
throws a (hopefully transient) 500, and we need test coverage of
handling these errors versus our existing 404 and 206 coverage.

Closes: #383
Approved by: mbarnes

9 years agotests/libtest.sh: Print non-matching file on failure
Colin Walters [Thu, 7 Jul 2016 21:36:08 +0000 (17:36 -0400)]
tests/libtest.sh: Print non-matching file on failure

We clean up the temporary directory on failure, which means it's hard
to know *why* a regex didn't match.  Print it when we hit an error.

Closes: #383
Approved by: mbarnes

9 years agopull: Free fetch_data by default
Mathnerd314 [Sat, 18 Jun 2016 16:23:12 +0000 (10:23 -0600)]
pull: Free fetch_data by default

This should fix the memory leaks in #352

This is a subset of the changes, the other part is in my pull code rewrite

Closes: #382
Approved by: cgwalters

9 years agostatic-delta-core.c: squash unused var warning
Jonathan Lebon [Mon, 4 Jul 2016 16:49:49 +0000 (12:49 -0400)]
static-delta-core.c: squash unused var warning

Closes: #379
Approved by: cgwalters

9 years agolibostree: Fix build failure with glib 2.42
Bastien Nocera [Mon, 4 Jul 2016 10:31:27 +0000 (10:31 +0000)]
libostree: Fix build failure with glib 2.42

G_DEFINE_AUTOPTR_CLEANUP_FUNC is a new function in GLib 2.44, but
libglnx contains a backported version of it. A few source files were
however using G_DEFINE_AUTOPTR_CLEANUP_FUNC either without including
libglnx.h, or without including it early enough.

This fix is similar to the one in commit d368624.

Closes #376

Closes: #377
Approved by: smcv

9 years agodocs: Add a section on Docker
Colin Walters [Thu, 30 Jun 2016 19:29:28 +0000 (15:29 -0400)]
docs: Add a section on Docker

This could have a lot more obviously, but just laying down my thoughts
as a starting point.

Closes: #374
Approved by: jlebon

9 years agodelta: Add --if-not-exists option
Colin Walters [Fri, 1 Jul 2016 18:39:49 +0000 (14:39 -0400)]
delta: Add --if-not-exists option

I often want to have "idempotent" systems that iterate to a known
state.  If after generating a commit, the system is interrupted, I'd
like the next run to still generate a delta.  But we don't want to
regenerate if one exists, hence this option.

Closes: #375
Approved by: jlebon

9 years agobuild: Override systemd unit directory for distcheck
Dan Nicholson [Mon, 27 Jun 2016 20:06:23 +0000 (13:06 -0700)]
build: Override systemd unit directory for distcheck

distcheck tests that all the files are installed under $prefix. That
doesn't work with the systemd unit directory since the path comes from
pkg-config. Override the setting to be under $prefix in that case.

Closes: #372
Approved by: cgwalters

9 years agotests: Improve check for /proc/cmdline kargs
Dan Nicholson [Fri, 13 May 2016 19:53:01 +0000 (12:53 -0700)]
tests: Improve check for /proc/cmdline kargs

On some systems there may be no root= argument, so the tests for
appending /proc/cmdline arguments will fail. Instead, loop over each of
the arguments in the host's /proc/cmdline and test that they're in the
constructed config file. That will actually test if ostree added all of
the system's /proc/cmdline args correctly. The regex isn't perfect here,
but it's probably good enough for this test.

Closes: #372
Approved by: cgwalters

9 years agotests: Remove extra $CMD_PREFIX from test-auto-summary.sh
Dan Nicholson [Fri, 13 May 2016 18:38:50 +0000 (11:38 -0700)]
tests: Remove extra $CMD_PREFIX from test-auto-summary.sh

$OSTREE already has $CMD_PREFIX in it, so adding it again causes you to
call env twice with LD_PRELOAD.

Closes: #372
Approved by: cgwalters

9 years agobuild: Distribute libglnx and bsdiff Makefile templates
Dan Nicholson [Fri, 13 May 2016 18:01:29 +0000 (11:01 -0700)]
build: Distribute libglnx and bsdiff Makefile templates

In order to re-run autogen.sh from the tarball, the libglnx and bsdiff
Makefile templates need to be provided.

Closes: #372
Approved by: cgwalters

9 years agotests: Ensure mutable deployments from libostreetest
Dan Nicholson [Fri, 13 May 2016 17:22:02 +0000 (10:22 -0700)]
tests: Ensure mutable deployments from libostreetest

When creating sysroots with libostreetest, we don't get the benefit of
the OSTREE_SYSROOT_DEBUG setting in libtest.sh. That means we'll get
immutable deployments that can't be easily cleaned up.

Ensure the environment variable is set before creating new sysroots. It
would be nice to set the debug flags directly, but that's private API
that isn't currently pulled into libostreetest.

Closes: #372
Approved by: cgwalters

9 years agotests: Remove gpg verification files from EXTRA_DIST
Dan Nicholson [Fri, 13 May 2016 13:47:09 +0000 (06:47 -0700)]
tests: Remove gpg verification files from EXTRA_DIST

Follow on from 70a11189. These files are already disted.

Closes: #372
Approved by: cgwalters

9 years agoostree admin switch: fix short summary
Jonathan Lebon [Mon, 27 Jun 2016 17:59:22 +0000 (13:59 -0400)]
ostree admin switch: fix short summary

Closes: #371
Approved by: cgwalters

9 years agocheckout: Add an option to require hardlinks
Colin Walters [Sun, 26 Jun 2016 14:25:03 +0000 (10:25 -0400)]
checkout: Add an option to require hardlinks

I've seen a few people hit this and wonder why checkouts are slow/take
space.  Really, ensuring this happens is the *point* of OSTree.
Physical copies should be a last resort fallback for very unusual
situations (one of those is rpm-ostree checking out the db since
librpm doesn't know how to read from libostree).

Even I hit the fact that `/var` is a mountpoint disallowing hardlinks
with `/ostree` once and was confused.  =)

Add this to the rofiles-fuse test case because it creates a mount
point.

Closes: #368
Approved by: jlebon

9 years agorofiles-fuse: Do allow fchmod/fchown on directories
Colin Walters [Sun, 26 Jun 2016 14:23:56 +0000 (10:23 -0400)]
rofiles-fuse: Do allow fchmod/fchown on directories

The program is called ro*files* and ostree creates physical
copies of directories, so changing them is fine.

I hit this when trying to do a copy checkout onto an rofiles-fuse
mount.

Closes: #368
Approved by: jlebon

9 years agotests: fail the build if symlinking tests/ostree fails
Simon McVittie [Sun, 26 Jun 2016 12:57:13 +0000 (13:57 +0100)]
tests: fail the build if symlinking tests/ostree fails

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #367
Approved by: cgwalters

9 years agotests: use our own generated libtool, not the one in $PATH
Simon McVittie [Sun, 26 Jun 2016 12:56:05 +0000 (13:56 +0100)]
tests: use our own generated libtool, not the one in $PATH

libtoolize creates a version of libtool for the right architecture
in $(top_builddir), which is guaranteed to be present, and is
guaranteed to match what we are compiling (even during
cross-compilation).

Packaging systems sometimes separate /usr/bin/libtool, which is
specific to one architecture, from the libtool development files
such as libtoolize and ltmain.sh, which are architecture-independent.
For example, in Debian, libtool_*_all.deb contains the files necessary
to libtoolize a package and is depended on by the dh-autoreconf package,
but libtool-bin_*_amd64.deb (or whatever architecture) contains
/usr/bin/libtool and is not normally necessary to depend on.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #367
Approved by: cgwalters

9 years agoentry_pathname_test_helper: these tests need extended attributes
Simon McVittie [Sun, 26 Jun 2016 13:26:37 +0000 (14:26 +0100)]
entry_pathname_test_helper: these tests need extended attributes

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #366
Approved by: cgwalters

9 years agobuild-sys: Make libostree-1.so depend on the symbol file
Colin Walters [Fri, 24 Jun 2016 13:35:21 +0000 (09:35 -0400)]
build-sys: Make libostree-1.so depend on the symbol file

Otherwise one changing it doesn't cause a symbol to be exported.

Closes: #365
Approved by: jlebon

9 years agotests: Test partial commits for local remotes
Alexander Larsson [Tue, 7 Jun 2016 12:38:21 +0000 (14:38 +0200)]
tests: Test partial commits for local remotes

This was broken before, fixed in the previous commit.

Closes: #324
Approved by: yuqi-zhang

9 years agopull: Write commitpartial files for local imports too
Colin Walters [Tue, 7 Jun 2016 13:50:58 +0000 (09:50 -0400)]
pull: Write commitpartial files for local imports too

Just like HTTP fetches, these can be interrupted, so we need to write
the commitpartial files.

Closes: #324
Approved by: yuqi-zhang

9 years agorefs: resolve conflict between local/remote repos
Yu Qi Zhang [Thu, 23 Jun 2016 16:11:50 +0000 (16:11 +0000)]
refs: resolve conflict between local/remote repos

Add the functionality to use the same name for refs in local and remote
repos. This helps users keep track of local refs of remote origin, much
like local and remote git branches.

Previously, when a local ref is specified, resolve_refspec would fall
back to searching through remote repos if the ref is not found locally.
This function now takes an extra flag to specify whether it should
search through remote repos. Additionally, ostree_repo_resove_rev_ext
was added to call resolve_refspec with fallback_remote being false, so
refs --create would no longer complain when trying to create a local
ref of the same name as a remote one.

Fix remote repo parsing not being handled correctly on refs --create.

Closes: #363
Approved by: jlebon

9 years agopull: Correctly handle repo->parent_repo when applying static deltas
Alexander Larsson [Thu, 23 Jun 2016 09:51:15 +0000 (11:51 +0200)]
pull: Correctly handle repo->parent_repo when applying static deltas

In flatpak i was using a parent repo, and it failed to update
with ENOENT when dispatching an set-read-source opcode, because the
object it referenced was in the parent repo.

This fixes that by making _ostree_repo_read_bare_fd look
at parent_repo.

Closes: #362
Approved by: cgwalters

9 years agorefs: Fix a logic error
Mathnerd314 [Sat, 18 Jun 2016 17:06:31 +0000 (11:06 -0600)]
refs: Fix a logic error

I encountered the Opening remotes/ dir error with some broken pull code, and this fixes it.

Closes: #358
Approved by: cgwalters

9 years agocore: Add OSTREE_OBJECT_TYPE_COMMIT_META
Mathnerd314 [Thu, 16 Jun 2016 05:37:29 +0000 (23:37 -0600)]
core: Add OSTREE_OBJECT_TYPE_COMMIT_META

This is cleaner than the loose_path_with_suffix approach

Closes: #359
Approved by: cgwalters

9 years agoconfigure: Turn on -Wempty-body
Mathnerd314 [Thu, 16 Jun 2016 19:59:06 +0000 (13:59 -0600)]
configure: Turn on -Wempty-body

I spent half an hour debugging an extra semicolon,
and this C "feature" is not used at all in ostree

Closes: #359
Approved by: cgwalters

9 years agocore: Use OSTREE_SHA256_STRING_LEN instead of 64
Mathnerd314 [Sat, 18 Jun 2016 16:31:19 +0000 (10:31 -0600)]
core: Use OSTREE_SHA256_STRING_LEN instead of 64

Closes: #359
Approved by: cgwalters

9 years agocore: Fix wrong return value docs
Krzesimir Nowak [Wed, 22 Jun 2016 09:16:21 +0000 (11:16 +0200)]
core: Fix wrong return value docs

ostree_commit_get_parent() returns a string form of a checksum, not a
binary form.

Closes: #360
Approved by: cgwalters

9 years agorefs: allow overwrite of empty folders
Yu Qi Zhang [Mon, 20 Jun 2016 20:20:58 +0000 (20:20 +0000)]
refs: allow overwrite of empty folders

We noticed that once a ref folder is created, there is no existing
command that can remove it. For example, once "foo/bar" is created,
even if the user deletes foo or all the refs under foo, the folder
will persist.

Now when the user attempts to create a ref "foo" either through commit
or refs --create, if a folder "foo" exists but is empty of refs, the
folder is removed and the new ref "foo" is created.

New unit tests in tests-ref.sh verify this functionality.

Closes: #354
Approved by: cgwalters

9 years agolibglnx porting: Drop uses of gs_file_openat_noatime
Colin Walters [Wed, 15 Jun 2016 01:55:40 +0000 (21:55 -0400)]
libglnx porting: Drop uses of gs_file_openat_noatime

We're not really doing the "noatime" thing anymore.

Closes: #341
Approved by: jlebon

9 years agolib: Use g_file_enumerator_iterate() if available, with fallback
Colin Walters [Wed, 15 Jun 2016 01:51:10 +0000 (21:51 -0400)]
lib: Use g_file_enumerator_iterate() if available, with fallback

Import `gs_file_enumerator_iterate()` for the next six months or
so...after RHEL 7.3 is released I'm strongly considering hard
requiring 2.46 or so.

Likely at some point we should figure out how to share more "glib
backport" code with NetworkManager at least.

Closes: #341
Approved by: jlebon

9 years agolib: Use sd_journal directly (optionally)
Colin Walters [Tue, 14 Jun 2016 17:12:21 +0000 (13:12 -0400)]
lib: Use sd_journal directly (optionally)

This was the last caller of libgsystem that isn't
`gs_file_get_path_cached()`.  I think the use case ostree has where
the same code can be called via command line and via a shared library
*and* via a daemon is rather unusual, so let's just copy the code for
logging from libgsystem into here.

For example rpm-ostree hard depends on a daemon mode, so it'll just
use `sd_journal` directly.

Closes: #341
Approved by: jlebon

9 years agolibglnx porting: Use of GSDirFdIterator
Colin Walters [Tue, 14 Jun 2016 14:46:15 +0000 (10:46 -0400)]
libglnx porting: Use of GSDirFdIterator

This one was pretty simple.  One of the uses in `repo.c` was just a
leftover variable.

Closes: #341
Approved by: jlebon

9 years agolibostree.sym: Fix test-symbols
Colin Walters [Mon, 20 Jun 2016 22:13:58 +0000 (18:13 -0400)]
libostree.sym: Fix test-symbols

The test isn't smart enough to ignore comments, so change the prefix.

Closes: #356
Approved by: jlebon

9 years agoRelease 2016.6
Colin Walters [Mon, 20 Jun 2016 14:46:50 +0000 (10:46 -0400)]
Release 2016.6

9 years agopull: Ensure we always process queue only from main thread
Colin Walters [Fri, 17 Jun 2016 02:16:27 +0000 (22:16 -0400)]
pull: Ensure we always process queue only from main thread

I was easily reproducing a hang on pulls with thousands of requests on
current git master.  The initial symptom seemed to be that there are
multiple code paths where we don't invoke
`session_thread_process_pending_queue()`.  We really need to do
that any time we remove something from the outstanding queue,
to ensure it gets filled again.

A further issue is that we were tying the lifecycle of the pending
object to the `GTask`, but the task could be unref'd from the main
thread (via a `GSource` on the main thread), and that introduced
threadsafety issues, because the hash table and other data suddenly
could be concurrently modified.

Both of these need to be fixed together.  First, we introduce
`Arc<Pending>`, and ensure that both the main and worker threads hold
references.

Second, we ensure that we re-process the queue *immediately* whenever
a task is done, inside the worker thread, rather than doing it
incidentally via an unref.  This architecture is quite similar to what
the outside pull code is doing.

Closes: #350
Approved by: jlebon

9 years agotests: Support OT_SKIP_READDIR_RAND
Colin Walters [Fri, 17 Jun 2016 13:43:51 +0000 (09:43 -0400)]
tests: Support OT_SKIP_READDIR_RAND

For some reason I'm really not inclined to debug right now, `libtool`
is eating the `-fsanitize=address` argument when linking
`libreaddir-rand.so`, which causes failures since we're trying to
`LD_PRELOAD`.

Closes: #351
Approved by: jlebon

9 years agobuild: Fix libreaddir-rand to honor global CFLAGS
Colin Walters [Fri, 17 Jun 2016 13:36:51 +0000 (09:36 -0400)]
build: Fix libreaddir-rand to honor global CFLAGS

It's unfortunate that in automake one has to explicitly include the globa
`$(AM_CFLAGS)` if one sets `CFLAGS`, and similarly for other variables.

I'm trying to use `-fsanitize=address`, and not including it was
causing linker failures.

We also weren't inheriting the global warnings etc., so I had to fix a
decl-after-statement.

Closes: #351
Approved by: jlebon

9 years agomanual: Discuss mirroring
Colin Walters [Thu, 16 Jun 2016 15:25:37 +0000 (11:25 -0400)]
manual: Discuss mirroring

This should likely be its own section, but it makes enough sense here
for now too.

Closes: #347
Approved by: yuqi-zhang

9 years agorepo: Avoid a possible divide by zero in progress
Colin Walters [Fri, 17 Jun 2016 01:51:13 +0000 (21:51 -0400)]
repo: Avoid a possible divide by zero in progress

The previous code was subject to a divide by zero if less than a
second had passed.  Rework it so we only do the divide if more than a
second has passed.

Closes: #349
Approved by: Mathnerd314

9 years agolibglnx porting: delete temp files on failure of file creation
Yu Qi Zhang [Thu, 16 Jun 2016 18:51:10 +0000 (18:51 +0000)]
libglnx porting: delete temp files on failure of file creation

We noticed the temp files being left over in ostree when (mistakenly)
trying to create refs with names in use by folders. This fix removes
temp files created by glnx_file_replace_contents_at on failure.

Closes: #348
Approved by: cgwalters

9 years agoAdd "archive" as an alias for "archive-z2"
Colin Walters [Thu, 16 Jun 2016 14:07:26 +0000 (10:07 -0400)]
Add "archive" as an alias for "archive-z2"

I find the "-z2" is really a long ago relic of the past when I changed
the format.  We no longer have anything to do with the original
`archive`, so let's start allowing people to type `--mode=archive`
which just looks saner.

At some point later I'll update the docs too, but it'll be an annoying
transition period as we'll have to say "On older OSTree, use -z2" etc.

Closes: #346
Approved by: giuseppe

9 years agomanual: Link to mender.io
Colin Walters [Wed, 15 Jun 2016 13:20:11 +0000 (09:20 -0400)]
manual: Link to mender.io

Came out of a discussion on the list.

Closes: #344
Approved by: jlebon

9 years agorefs: add "ostree refs --create" and unit tests
Yu Qi Zhang [Tue, 14 Jun 2016 14:13:06 +0000 (14:13 +0000)]
refs: add "ostree refs --create" and unit tests

Added the ability to create a ref (much like a git tag) for an
existing commit through "ostree refs EXISTING --create=NEWREF".
Previously the only way to create a new ref was by creating a new commit,
but refs --create allows multiple refs to point to the same commit.

The command will fail if:
 - None/more than one existing ref is specified
 - The specified EXISTING tag does not exist, or was not specified
 - The specified NEWREF already exists, or is the name of a folder

Add unit tests in tests-ref.sh to verify above functionality

Closes: #340
Approved by: jlebon

9 years agolib: Port some manual close() cleanups to be glnx_fd_close
Colin Walters [Thu, 9 Jun 2016 18:30:14 +0000 (14:30 -0400)]
lib: Port some manual close() cleanups to be glnx_fd_close

Just noticed this while reading some code, we didn't have many manual
`out: close()` bits left, this pushes us over the edge to autocleanup
almost everywhere.

Closes: #332
Approved by: jlebon

9 years agobuild: re-create tests/ostree-symlink-stamp if Makefile changes
Simon McVittie [Sun, 12 Jun 2016 13:32:51 +0000 (09:32 -0400)]
build: re-create tests/ostree-symlink-stamp if Makefile changes

The filename of the real ostree executable could be either .libs/ostree
or .libs/lt-ostree.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #337
Approved by: cgwalters

9 years agolibostreetest: include libtest.sh from srcdir, not builddir
Simon McVittie [Sun, 12 Jun 2016 13:21:19 +0000 (09:21 -0400)]
libostreetest: include libtest.sh from srcdir, not builddir

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #337
Approved by: cgwalters

9 years agolibtest: make gpghome in tmpdir writeable
Simon McVittie [Sun, 12 Jun 2016 09:51:11 +0000 (10:51 +0100)]
libtest: make gpghome in tmpdir writeable

Otherwise, during "make distcheck" it will be read-only (because it
is a copy of the read-only ${srcdir} with permissions preserved), and
deletion will fail during cleanup.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #337
Approved by: cgwalters

9 years agobuild: distribute more test files
Simon McVittie [Sun, 12 Jun 2016 09:45:48 +0000 (10:45 +0100)]
build: distribute more test files

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #337
Approved by: cgwalters

9 years agobuild: distribute TAP helper scripts in tarballs
Simon McVittie [Sun, 12 Jun 2016 09:43:34 +0000 (10:43 +0100)]
build: distribute TAP helper scripts in tarballs

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #337
Approved by: cgwalters

9 years agobuild: distribute test scripts in tarballs
Simon McVittie [Sun, 12 Jun 2016 09:39:46 +0000 (10:39 +0100)]
build: distribute test scripts in tarballs

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #337
Approved by: cgwalters

9 years agobuild: distribute libostree.sym in tarballs
Simon McVittie [Sun, 12 Jun 2016 09:36:44 +0000 (10:36 +0100)]
build: distribute libostree.sym in tarballs

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #337
Approved by: cgwalters

9 years agoautogen.sh: rely on VPATH for submodules' Makefile-*.am.inc
Simon McVittie [Sun, 12 Jun 2016 09:31:29 +0000 (10:31 +0100)]
autogen.sh: rely on VPATH for submodules' Makefile-*.am.inc

This avoids hard-coding the autogen-time ${srcdir} into our build
system, and might fix "make distcheck".

We don't need to specify ${srcdir} explicitly in the various variables,
because Automake always uses make's VPATH feature to look in both
${builddir} and ${srcdir} at build time.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #337
Approved by: cgwalters

9 years agoLink libreaddir-rand to libdl
Simon McVittie [Sun, 12 Jun 2016 14:25:21 +0000 (10:25 -0400)]
Link libreaddir-rand to libdl

It uses dlsym(). There's no point in being extra-portable here
because OSTree only targets Linux anyway.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #336
Approved by: cgwalters

9 years agotest-sysroot.js: set "strict mode" when sourcing libtest.sh
Simon McVittie [Sat, 11 Jun 2016 18:07:40 +0000 (19:07 +0100)]
test-sysroot.js: set "strict mode" when sourcing libtest.sh

As with the C tests in commit 08580118, this makes sure the test
fails as soon as something goes wrong.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #335
Approved by: giuseppe

9 years agotests: Exit valgrind tests if a leak is detected
Alexander Larsson [Fri, 10 Jun 2016 11:28:08 +0000 (13:28 +0200)]
tests: Exit valgrind tests if a leak is detected

This fails the test if OT_TESTS_VALGRIND is set and valgrind
detects a leak.

Closes: #334
Approved by: cgwalters

9 years agopull: Fix leak of refs_to_fetch
Alexander Larsson [Fri, 10 Jun 2016 10:13:23 +0000 (12:13 +0200)]
pull: Fix leak of refs_to_fetch

Closes: #333
Approved by: giuseppe

9 years agopull: Fix leaked uri in request_static_delta_superblock_sync
Alexander Larsson [Fri, 10 Jun 2016 10:12:58 +0000 (12:12 +0200)]
pull: Fix leaked uri in request_static_delta_superblock_sync

Closes: #333
Approved by: giuseppe

9 years agopull: Fix leak of FetchObjectData in some cases
Alexander Larsson [Fri, 10 Jun 2016 10:12:33 +0000 (12:12 +0200)]
pull: Fix leak of FetchObjectData in some cases

Closes: #333
Approved by: giuseppe

9 years agopull: Fix leak of debug temporary strings
Alexander Larsson [Fri, 10 Jun 2016 10:12:07 +0000 (12:12 +0200)]
pull: Fix leak of debug temporary strings

Closes: #333
Approved by: giuseppe

9 years agolibotutil: Fix leak of VariantMapData
Alexander Larsson [Fri, 10 Jun 2016 10:10:37 +0000 (12:10 +0200)]
libotutil: Fix leak of VariantMapData

Closes: #333
Approved by: giuseppe

9 years agotests: Modernize valgrind infrastructure
Colin Walters [Wed, 11 May 2016 19:54:48 +0000 (15:54 -0400)]
tests: Modernize valgrind infrastructure

The recent memleak fixes motivated me to look at the bitrotted code to
run invocations of `ostree` in the test suite underneath valgrind.

There are a few things here.  First, update suppressions file from
libhif, since I recently worked on it.

When running *uninstalled* as we now support, we need
`libtool --mode=execute` in the mix so it expands out to
the uninstalled binary and we don't valgrind the intermediate shell.

However, it's harder than that because we chdir into a tmpdir,
which defeats the libtool logic.  AFAICS, the only fix for this
is to determine the realbin path before we chdir, and then unfortunately
we need to change every use of `ostree` to `${OSTREE}` =(

Then this immediately breaks for me on RHEL7 because my ancient
copy of `valgrind-3.10.0-16.el7.x86_64` is unaware of syscall 306, i.e.
`syncfs`.

But let's do this first before I dive into that.

Closes: #292
Approved by: krnowak

9 years agolib: Add OSTREE_SUPPRESS_SYNCFS environment variable
Colin Walters [Thu, 9 Jun 2016 14:49:03 +0000 (10:49 -0400)]
lib: Add OSTREE_SUPPRESS_SYNCFS environment variable

Just to work around valgrind not understanding the `syncfs()` syscall
in EL7 right now.

Closes: #292
Approved by: krnowak

9 years agolib: Fix a leak in remote parsing
Colin Walters [Wed, 11 May 2016 17:32:40 +0000 (13:32 -0400)]
lib: Fix a leak in remote parsing

As the docs say, `g_regex_match()` still allocates a match even if it
returns `FALSE`.  Using `g_autoptr` is just plain better.

Closes: #292
Approved by: krnowak

9 years agorelated-projects: Update with more information and projects
Mathnerd314 [Fri, 3 Jun 2016 20:14:49 +0000 (14:14 -0600)]
related-projects: Update with more information and projects

In particular, NixOS has changed somewhat, and Conda is worth
looking at. Also it seems reasonable to mention rpm-ostree /
Gnome Continuous.

Closes: #331
Approved by: cgwalters

9 years agodocs: Get API docs working again
Mathnerd314 [Sat, 4 Jun 2016 22:16:05 +0000 (16:16 -0600)]
docs: Get API docs working again

This changes around a few things that didn't work for me:
* Section names seem to be ostree-* instead of libostree-*
* Also XML files are ostree-* (they didn't show up at all)
- gtk-doc doesn't seem to parse const _OSTREE_PUBLIC correctly
* pull documentation is now on the actual functions rather than stubs
* Update gitignore with some more files

And there some changes to make gtk-doc give fewer warnings (not finished)

Closes: #327
Approved by: cgwalters

9 years agopull: Move pull and pull_onedir back into ostree-repo.c
Mathnerd314 [Wed, 1 Jun 2016 23:47:08 +0000 (17:47 -0600)]
pull: Move pull and pull_onedir back into ostree-repo.c

They call pull_with_options, which will fail anyway.

Closes: #327
Approved by: cgwalters

9 years agopull: Move libsoup-related code from ostree-repo.c to ostree-repo-pull.c
Mathnerd314 [Wed, 8 Jun 2016 18:48:44 +0000 (12:48 -0600)]
pull: Move libsoup-related code from ostree-repo.c to ostree-repo-pull.c

This centralizes the ifdef's in one file, which will make it
easier to write new pull backends.

ostree-repo-pull.c is now built unconditionally

Closes: #327
Approved by: cgwalters

9 years agorepo: use OSTREE_TIMESTAMP (=1) for checked-out files
Mathnerd314 [Wed, 8 Jun 2016 21:39:06 +0000 (15:39 -0600)]
repo: use OSTREE_TIMESTAMP (=1) for checked-out files

1 is a better choice than 0 because some programs use 0
as a special value; for example, GNU Tar warns of an
"implausibly old timestamp" with 0.

Closes: #330
Approved by: cgwalters

9 years agorepo: (minor) Drop a GFile usage in signature creation
Colin Walters [Fri, 3 Jun 2016 15:04:17 +0000 (11:04 -0400)]
repo: (minor) Drop a GFile usage in signature creation

Just one user of hundreds but, the rest of the function was ported
now.

Closes: #319
Approved by: jlebon

9 years agolib: Add a helper for mmap->bytes with openat(), use it in repo
Colin Walters [Fri, 3 Jun 2016 15:00:10 +0000 (11:00 -0400)]
lib: Add a helper for mmap->bytes with openat(), use it in repo

This kills another GSystem consumer...I think down the line I'd like
to do something like "detect whether file is > 1k if so, mmap,
otherwise just readall()" so we can use this helper in more places.

Closes: #319
Approved by: jlebon

9 years agolib: Add `_ALLOW_NOENT` flag to internal variant mapping API
Colin Walters [Fri, 3 Jun 2016 14:40:56 +0000 (10:40 -0400)]
lib: Add `_ALLOW_NOENT` flag to internal variant mapping API

We have a lot of "allow_noent" type wrapper functions since
a common pattern is to allow files to not exist, but still
throw cleanly on other issues.

This is another instance of that, and cleans up duplicated error
handling code.

Part of this is prep for moving away from `GFile` consumers.

Closes: #319
Approved by: jlebon

9 years agoglnx porting: Drop use of gs_file_openat_noatime
Colin Walters [Fri, 3 Jun 2016 14:22:05 +0000 (10:22 -0400)]
glnx porting: Drop use of gs_file_openat_noatime

As noted previously the "noatime" thing is mostly obsoleted by
relatime.

Closes: #319
Approved by: jlebon

9 years agolibglnx porting: Drop last use of gs_transfer_out_value()
Colin Walters [Fri, 3 Jun 2016 14:16:25 +0000 (10:16 -0400)]
libglnx porting: Drop last use of gs_transfer_out_value()

Closes: #319
Approved by: jlebon

9 years agoglnx porting: Drop last uses of gs_file_get_basename_cached()
Colin Walters [Fri, 3 Jun 2016 14:18:57 +0000 (10:18 -0400)]
glnx porting: Drop last uses of gs_file_get_basename_cached()

I apparently missed a few uses in the previous porting.

Closes: #319
Approved by: jlebon

9 years agorepo: Fix build on 32-bit systems
Krzesimir Nowak [Thu, 9 Jun 2016 10:42:28 +0000 (12:42 +0200)]
repo: Fix build on 32-bit systems

On 32-bit systems the modifier for printing 64bit values should be
%llu instead of %lu. Just use appriopriate macros that do the right
thing.

Closes: #329
Approved by: giuseppe

9 years agoconfigure.ac: properly check for bison
Jonathan Lebon [Tue, 7 Jun 2016 19:08:16 +0000 (15:08 -0400)]
configure.ac: properly check for bison

The AC_PROG_YACC already does the checking for us, so we don't need to
use AC_CHECK_PROGS (which wasn't working anyway because autoconf didn't
run the check thinking it was cached already from the earlier
AC_PROC_YACC, so we didn't get the default ":" value)

Closes: #325
Approved by: cgwalters

9 years agoostree_repo_write_commit: add missing docstring arg
Jonathan Lebon [Tue, 7 Jun 2016 18:44:55 +0000 (14:44 -0400)]
ostree_repo_write_commit: add missing docstring arg

Closes: #325
Approved by: cgwalters

9 years agotests/test-pull-c: New test that runs through the pull API via C
Colin Walters [Mon, 6 Jun 2016 18:49:11 +0000 (14:49 -0400)]
tests/test-pull-c: New test that runs through the pull API via C

We have had in the past issues with running `ostree_repo_pull()`
multiple times in the same process, embarassingly enough.  Nothing in
the current test suite covers this, so let's start.

Closes: #322
Approved by: jlebon

9 years agotests: Use strict mode by default for C tests
Colin Walters [Mon, 6 Jun 2016 19:00:13 +0000 (15:00 -0400)]
tests: Use strict mode by default for C tests

I was extending the C-based test suite to cover more, and noticed that
we weren't aborting if a command failed.  That made the tests somewhat
less useful, so let's fix it.

Closes: #321
Approved by: jlebon

9 years agosummary: Fix a typo
Krzesimir Nowak [Fri, 3 Jun 2016 19:35:52 +0000 (21:35 +0200)]
summary: Fix a typo

The --gpg-sign parameter will be used for signing the summary, not the
commit. This probably was copy-pasted from the ostree commit command.

Closes: #320
Approved by: cgwalters

9 years agoglnx porting: Port away from gs_file_get_basename_cached()
Colin Walters [Tue, 31 May 2016 15:35:35 +0000 (11:35 -0400)]
glnx porting: Port away from gs_file_get_basename_cached()

In some cases we use glnx_basename(), in others we already had a
`GFileInfo` around with the name.

Closes: #316
Approved by: jlebon